﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static KongMing.ORM.SqlSugar.SqlSugarHelper;
using KongMing.ORM.SqlSugar.Models;

namespace KongMing.ORM.SqlSugar
{
    public class CodeFirst创建表
    {
        public static void Go()
        {
            using (var db = GetDB())
            {
                //同步数据库表结构
                db.DbMaintenance.CreateDatabase();
                db.CodeFirst.SetStringDefaultLength(200).BackupTable().InitTables(new Type[]
                {
                    typeof(Test)
                });
                Console.WriteLine("创建成功！");
                Console.ReadKey();
            }
        }
    }
}
